Flash the ROM and all data will be gone. Factory reset and all data you've installed will be gone. (But that sometimes leaves the data recoverable by people who know how to do it.)
If you're getting rid of the phone, a blowtorch (seriously) will destroy all your data.