按照 can both function as a preposition that can be translated as according to. I imagine that the translation does not capture the individual character of each term. What nuances do the two individual terms express and in what situation/context would you use one rather than the other?
根据 is more formal, and preferably used when speaking about doing something according to some serious guidelines. Like following a law.
按照 is less formal, and can be used when doing something according to some less serious guide. Like following a person's idea.
根据新法律上的规定，小学老师都必须.. In accordance with the new law, all elementary school teachers must... 按照我们家的习惯，晚上九点钟小孩要去睡觉。 At our home we are accustomed that kids go to sleep at 9pm.
According to 现代汉语虚词词典:
根据 - （介词） 介绍得出某种论断的依据。介词短语可以修饰主谓短语。
按照 - （介词） 表示动作行为遵从莫一标准。
So, in actuality, the times when they are completely interchangeable (meaning not just that the sentence would make sense, but that it would also have the same meaning) would appear to be relatively rare, even though they translate to roughly the same thing in English. 按照 introduces a principle or formula according to which an action is carried out, while 根据 introduces the grounds on which some conclusion, decision, or judgement rests.
As a verb, 根据 simply means "based on". For example:
Based on my intuition, he should be a teacher. (direct translation)
My intuition tells me that he is a teacher.
As a noun, 根据 is the "basis of something". For example:
What you have expressed is just your personal opinion, there is no basis whatsoever.
按照 can only be used as a verb. It means "in accordance to/with", or more specifically, "as directed or required by" something, which could be a rule, a tradition, a law, a set of instructions, etc. For example:
In accordance with the Criminal Code, Section 304(a) provisions for culpable homicide not amounting to murder, whoever convicted, may be sentenced to life imprisonment, or imprisonment of up to 20 years, and may also be liable to a fine or caning.
As seen from the examples above and contrary to some answers, 按照 can also be used formally and 根据 informally. So, the formality is not really an issue. When used as verbs for the purpose of comparison, 按照 must be followed by a rule or direction, whereas 根据 must be followed by a basis.
If the rule forms the basis of a decision, then 根据 can be used. For example:
根据校方规定(rule as a basis)，经过授权的学生可以自由进入实验室。
Based on the rules set by the [school] authority, students who have been authorized can enter the lab freely.
根据 has more a "by..." feeling in English, which gives a stronger sense of sureness. 按照 has a more "according to..." feeling, which is used more in colloquial setting. But in most cases, these two are interchangeable, but used of 根据 is rare in daily conversation as a preposition (mostly only "据" or "照", e.g. 据/照他说...). Note that 根据 can also be used as a noun, but 按照 cannot. e.g. 这事没有根据 (This thing comes out of thin air).
No much difference in daily use, but in formal text, 根据 is prefer. And 根据 also can be a noun (example: 你有什么根据？) which means "the reason or source for".
根据 means you can find the rules, ordinance etc in written format or published. 按照 means you may follow some rules, conventions that are not necessarily in written format
One point that has been missed is that 根据 also has the use of "according to [source of information]", e.g.
This use appears frequently in news articles.
Source: internship at the EVIL People's Daily.