Welcome to Android Central! Was the phone acting up beforehand, or did it suddenly do the factory reset?
How much of your data you can get back depends on where that data was being saved or synced to, and if you had done any recent backups. If most of your data is associated with your Google account (e.g., contacts saved to Google Contacts, calendar events saved to your Google Calendar account, photos backed up to Google Photos, etc.), then it should all sync back once you log back into your Google account. This is the beauty of using Google as your main storage. If you use other cloud backups (like Samsung or Verizon), then you'll have to log into those respective accounts.
If you only had data saved locally, then I'm afraid it's gone. Always be sure to backup your data regularly, or keep it synced with a cloud account, since phone storage is not forever.