Jesus said, "Anyone who loves me will obey my teaching."
If I love God I will obey him.1
Maybe I don't love God. If I'm honest with myself I have to say I don't obey him--not perfectly. And if I don't obey him, I don't love him. Not only this, but because I like to think I'm better than what I am, I'm prone to be a hypocrite. (How many people say they love God but obviously don't? See 1 John 4:20)
But it's not all bad news. Even though I don't love him as I should, he still loves me. Nothing I can say or do will stop him loving me. And nothing you can say or do can stop God loving you.
Jesus commands are not meant to show us we fall short and therefore deserve punishment. They're meant to show us that we don't love God, and that he loves us anyway. See here.
1. The key to obeying God is loving God. The key to loving God is seeing how good he is. Once we focus our minds on how good God is, by reminding ourselves that he became a man and died for us, and by also reminding ourselves that he will eventually save us and all those we love, then we must set our wills on immediately obeying Jesus. When we do this, God begins to set us free from our sin. The more we are made like Christ, the more we will love him. And the more we love him, the more we will be made like him. This is God’s positive feedback loop.