data recovery

Is there a way for iphone 4 and 5 to retrieve data such as text messages that has been deleted? Directly from the iphone would be the best.
Based upon my experience, the answer is no.
Without a backup or a warrant/subpoena, no.
Definitely no.
An iOS device has to be backed up like a normal PC. To not forget backing up use iCloud. Your device will be backed up automatically if it's locked and connected to WiFi and the power supply.
The problem is that you are not able to restore specific data like contacts. Only your whole device can be restored.
If contacts are of high importance for you install an app like MCBackup which can save all your contacts by sending them to your own E-Mail address.
Other relevant data must be saved via the File Sharing section of iTunes.
Deleted files are stored in the device’s database until it overwritten with new content so u can directly recover your text messages without any backup. Just load the iTunes backup files this itunes creates a regular backup whenever you synchronized your iPhone with itunes. This will allow you to select the one you want to recover .

Still if you are not able to recover data from iTunes Backup then you can also use iPhone Data Recovery Software. you can free download software from iPod Touch Data Recovey - Recover Lost iPod Touch Music, Photos, SMS & More!

You typed, "...u can directly recover your text messages without any backup. Just load the iTunes backup files..." I'm confused.
Or try restore from icloud.

iCloud: Restore your iOS device from iCloud

Original thread: https://forums.imore.com/threads/data-recovery.250532/