This is how data recovery programs work, by scanning for files that have been marked as deleted.
Defragging a drive may prevent undeletion, as the blocks used by deleted file might be overwritten since they are marked as "empty".
The common problem with sensitive data is that deleted files are not really erased and so may be recovered by interested parties.
But even overwriting parts of the disk with something else or formatting it may not guarantee that the sensitive data is completely unrecoverable.
Special software is available that overwrites data, and modern (post-2001) ATA drives include a secure erase command in firmware.