More often than not, lost iPhone data is still intact, but just ‘unallocated’.
When you write more data to the iPhone, these files are likely to be overwritten. So the secret is not to use the iPhone until you’ve recovered any lost data.
There are a number of third party tools for recovering lost data and they are all easy to use and fundamentally work in the same way. There are a number of free tools. However, they are not always that reliable and can yield very different results in terms of recoverable files. What’s more, the more attempts at data recovery, the lesser the chance of a successful outcome.
Further reading
How to recover deleted photos
How to undelete files with free data recovery software
Flash data recovery - Chip-Off and JTAG