If your contacts are gone from both the device and at icloud.com, then your only choice is to restore from a backup you made from the device to either itunes on your computer or icloud.
Go to Settings>General>Reset and tap Erase All Content and Settings. This will erase your device. Then you will go through the setup screens again as you did when your device was new, and when given the option, select Restore from iCloud Backup.
This link gives another overview of backup and restore: