Sorry, but you don't, unless you have the messages and pics backed up somewhere. Even a deleted file "undeleter" won't restore messages, and you;d have to root the phone first (which could overwrite some of the pictuers - and it voids the warranty).
Check if Google backed up any pics by installing Google Photos and checking all Google accounts (you had on the phone before the reset) within Photos.
Edit: sms messages don't usually auto backup, unless through some 3rd party apps. If it's Whatsapp it could very likely be backed up if you're on wifi regularly.