Why does my iPhone 4 keep erasing all data?

Why does my iphone 4 erase all data when the battery dies? So it erases all data, and has the same icon when you first buy it and need to sync it to iTunes (has the iTunes. Logo and the sync cable going up toward the iTunes logo. Just like when you first buy it and turn it on). Best answer 10 points!

Restore your iPhone!