The Christian life is a balance, a narrow road if you will, in which there are dangers to either side. Too far to the one side and you fall into unrepentant rebellion against God's law. Too far to the other side and you become a cold-hearted legalistic idolater. How do you walk the balance? By knowing God, following Christ, and through the enabling work of the Spirit.
We must know God if we are to understand his word properly. This is where the Pharisees went so horribly wrong. Verse seven says as much. "If you had known what this means, "I desire mercy, and not sacrifice,' you would not have condemned the guiltless." Notice that the verse Jesus quotes from Hosea is a passage about God's heart. It's not that they merely misunderstood a command, no, they misunderstood God's own heart. They were, quite simply, idolaters. They worshipped a god who was merciless, graceless, and loveless. They worshipped a god who was, not coincidentally, just like themselves.
If there is a fundamental misunderstanding of the character and nature of God in your heart or mind it will lead you into idolatry. This is why the early church struggled so valiantly to define clearly what the Scripture teaches about God. This is why we should labor humbly in the word of God, studying the Lord himself, so we will be able to defend our own hearts and minds from the mistakes of the Pharisees.
"And this is eternal life, that they know you the only true God, and Jesus Christ whom you have sent." (John 17:3)
--Looking to learn more about the character of God? I highly recommend J.I. Packer's classic work, Knowing God.