How far back can a data recovery program go?

When using a data recovery program for iphone 5 (wondershare dr fone) how far back can it go to recover deleted text messages?

I'm not sure about phones but I can't see how it would be any different from a pc. Unfortunately it's not a case of knowing how far to go back. The hard drive writes its data to small units called "sectors" and when something gets deleted, the particular sector that the file was stored on gets flagged for "rewriting" which means that data can be written on that sector on top of the old data. Some programs can recover information that has been rewritten many times over and then some will only try and recover the first few layers or even just the first layer. You will have a good chance if its a recently deleted file and you haven't used the phone (apps, files etc) but if it was deleted a long time ago and you use the phone a fair bit then I'm afraid you chances of recovers are reduced as there's a high chance that it has been written over several times. I'm not saying it's impossible so give it a go you never know until you try.