It is not clear from your question whether you have the data files or not. If you have them, you can just copy all database files to the data directory such as "/var/lib/postgresql/data". If you faced any trouble while restoring the data files because of version mismatch, you can simply upgrade/downgrade the database server to the needed version. This should not cause you problems as you are restoring the whole data directory and there is no need to worry about existing data.
The steps are as follow:
1- Shutdown your postgresql server if it is running.
2- Copy all files to the data dir.
3- Start your database server and check your data.
You have to be careful about the source and destination platform of the data files. Previously, I tried to copy the data directory from one system to another, but it fails because of platform mismatch (32-bit system and 64-bit system).