1. You can still do unethical things that are too small or too big for laws to handle. It's perfectly legal to cheat on your partner, or to mock a bullied child, or to form a political party that takes power and repeals laws you don't like.
2. Even for the things that are covered by laws, a superhuman AI would be able to find bizarre loopholes that obey the letter of the law but would be considered unethical by most people.
Frederic Bastiat wrote a short book "The Law" where he elaborates on this and the purpose of law.
Thomas Jefferson was also very aware about questioning inmoral laws.
Criminal law always tries to formalize the average ethical landscape of citizens. But there are lots of ways how you can try to do it. And success varies greatly. Anyhow it's the best thing anybody has.
In which case, we might define "act according to the law" as something like "act in a way which, if it were described in a court of law, would not lead to any prosecution". Predicting the outcome of such a hypothetical court hearing requires anticipating, thinking through and weighing up the possible arguments on both sides. That's basically a description of ethics, so we're back where we started :(
The law defines what is permitted, not what is ethical.