Make sure you have made backup before resetting you iPhone, and then restore your iPhone from iCloud backup as the steps the answer below mentioned for you. If you have made backups on your iTunes, you can also restore your iPhone from iTunes backup.
Step 1. Connect your device to the computer that you stored your backup on.
Step 2. Open iTunes. If iTunes tells you there's an iOS update, get the latest version.
Step 3. Go to File > Devices > Restore from Backup. If you're using Windows and don’t see a File menu, press the Alt key.
Step 4. Look at the date and size of each backup and pick the most relevant.
Step 5. Click restore and wait for the process to finish. Your device will restart and then sync with your computer. Stay connected until the sync finishes.
Or you can use some third-party app like PhoneRescue or iFonebox to selectively restore iPhone of what you need from backups.