Galatians 2:16 and Romans 2:14 are perfect examples of the works of the law in the Old Testament, which includes circumcision, observance of special days, dietary laws about eating and drinking, etc; and the New “perfect law” (James 1:25) as given in the New Testament that does not include circumcision of the flesh, observance of special days, etc, for those things are works no longer required, God nailed them to the cross (Colossians 2:14).
We are always to obey the perfect law.
And exactly how are we to obey the law?
"I can to all things through Christ which strengtheth me."
---Philippians 4:13