Flash memory is Electronically Erasable Programmable Read Only Memory. In this data is stored by the On or Off state of the transistor. Then How it is possible to recover the data stored in the device even after formatting it ?
Because just like with magnetic media, normal "formatting" does not actually erase the sectors used for file data until the space needs to be reused. Until that happens, it is generally possible to reconstruct most of the data structures that describe the files, which is what data recovery software is doing.