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.
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!