The history between Elves & Dwarves in Tolkein's lore is one of the most conflicted & complex rivalries set in Middle-Earth & stems from ancient times. Their natural traits aren't complimentary & lead to numerous conflicts throughout the Ages.
However, the relationship between Legolas & Gimli establishes the possibility of fellowship & friendship between both races. Neither are greedy & selfish. They don't crave power or luxury which allows them to settle their differences, fight together & eventually bond to a point of genuine friendship.