It is the New Testament version of the Old Testament book of Proverbs. The faith that James is talking about is the kind of faith that operates where the rubber meets the road and where the water meets the wheel. This little book of five chapters has had a couple of strikes against it in Christian history.
It is made up of pithy sayings, commands, imperatives, and words of practical wisdom. The theme of James is that faith wears work clothes. First of all, the book of James was slow to be accepted by the early church as Scripture.
So within the first years of the Christian era, these books began to be compiled and everybody recognized they were New Testament books. We have to fulfill these sacraments, then there is a good possibility we’ll go to heaven.
James was one of the last of those books to be accepted and there was some dispute about it for a while. Or at least we’ll go to purgatory and eventually on to heaven.
Now we know, looking at it from our perspective, that the two statements appear to be contradictory on the surface but actually are not.