The bill of rights came from the English Bill of rights when America was still under Britain's control. When we left Britain's control, we needed a foundation for our government to run off of. So, the founders went to work writing the Constitution. Federalists argued that the Constitution did not need a BoR. Anti-federalists refused to sign the const. without a BoR. The Bill of Rights was added and the Constitution was ratified.
The purpose of the Declaration of Independence was to explain to foreign nations why the colonies had chosen to separate themselves from Great Britain.