How to recover data and fix the randomly restart iPhone?

After you updating your iOS system of iPhone, you may find that your iPhone will randomly restart by itself. This could cause great trouble for you in using. It indicates that there is something wrong with your iPhone. You should try to fix this problem.
Before fixing this issue: back up your iPhone
Before you are trying to fix your iPhone, you should back up your iPhone to iTunes to avoid data loss. If you reset your iPhone or lost your data after that, you can restore your backup to iPhone in iTunes.

How to fix the randomly restart iPhone?
If it restart when you charge it
Clean your iPhone and lightning port
First of all, you can clean your iPhone if there are dust collected in the ports of headphone, USB port, which could cause connection and charging problems.
Second, you can try to change the USB cable, charger or replace the battery. You can ask the Apple store for help.
iPhone keeps restarting randomly while in using
If your iPhone frequently reboot by itself in using, you can reboot iPhone to see if these problem has been solved.
If still not, you need to reset all the settings of your iPhone. Go to Settings>General>Reset>Reset All Settings. It will reset all the settings on your iPhone to factory state.
If there are some newly installed app that cause your iPhone crashes or restart, you can delete them from your iPhone and install the latest version.
If you encounter this problem after updating, you can choose to downgrade iOS to get rid of the issues.

How to restore data on iPhone after data loss?
If you have backed up your iPhone data to iTunes, you can easily restore from iTunes on your computer.
Open iTunes and connect your iPhone with computer.
Click phone icon on iTunes software and Click Restore Backup…
If you do not want to restore the entire backup data to your iPhone, you can choose to use an iPhone recovery software to extract data you need.
Install and run H Data iPhone recovery software on computer.
The recovery software will automatically display your iTunes backups on computer. If you do not find the one you need, you can choose the one you need by manual.
Click SCAN button on the software to automatically scan for all data on iPhone.
After scan, you are able to preview all data. You can see different contents on your iPhone, such as contacts, photos, messages and other data on apps.
Tick all the data that you need and choose a recovery path to save them.
Even if you do not have any backups, you still have chance to restore your lost data. If you recover with data recovery software in time, the lost data have not been replaced by new data, you are sure to retrieve the data you need.