This is the original Hebrew,
וַיֹּ֣אמֶר מֹשֶׁ֣ה אֶֽל־אַהֲרֹ֡ן וּלְאֶלְעָזָר֩ וּלְאִֽיתָמָ֨ר ׀
בָּנָ֜יו רָֽאשֵׁיכֶ֥ם אַל־תִּפְרָ֣עוּ ׀ וּבִגְדֵיכֶ֤ם לֹֽא־תִפְרֹ֙מוּ֙
וְלֹ֣א תָמֻ֔תוּ וְעַ֥ל כָּל־הָעֵדָ֖ה יִקְצֹ֑ף וַאֲחֵיכֶם֙ כָּל־בֵּ֣ית
יִשְׂרָאֵ֔ל יִבְכּוּ֙ אֶת־הַשְּׂרֵפָ֔ה אֲשֶׁ֖ר שָׂרַ֥ף יְהוָֽה׃
The meaning of the word in question תפרעו is uncertain, and this is why there is disagreement between the translations.
It seems like the KJV in Lev. 10:6 is following the Septuagint version which translates the original text as "do not take off your mitre". It is well known that the priests wore tall mitres on their heads during their service in the temple, and even now they were not to take them off but continue their service to god. Thus, the uncovering of their heads here does not in any way contradict the covering of the heads in 2 Samuel 15, as the former was not a regular uncovering of the head but the removal of the priestly garments.
In any case, I prefer the NIV here (most others concur with the NIV) which renders Lev. 10:6, "Do not let your hair become unkempt". Indeed the custom in Israel was to let the hair grow and become disheveled during one's mourning period. See 2 Samuel 19:25, where Mephibosheth did not trim his moustache or his toenails and did not wash his cloths, for he was mourning for David's banishment from the city. So this would eliminate any inconsistency between Leviticus and Samuel. Indeed as you observe the custom was to cover the heads during one's mourning as is evident from 2 Samuel 15. See also Esther 6:12. Leviticus on the other hand engages in another Israelite custom during mourning to let one's hair grow wild.
It is interesting to note that the Hebrew root of פרע that surfaces in Lev. 10:6 and other places in the context of hair also comes up in a different context in Exodus 32:25,
This is the original Hebrew text,
וַיַּ֤רְא מֹשֶׁה֙ אֶת־הָעָ֔ם כִּ֥י פָרֻ֖עַ ה֑וּא כִּֽי־פְרָעֹ֣ה
אַהֲרֹ֔ן לְשִׁמְצָ֖ה בְּקָמֵיהֶֽם׃
The NIV renders this as follows,
Moses saw that the people were running wild and that Aaron had let
them get out of control and so become a laughingstock to their
enemies.
But the KJV renders it differently,
And when Moses saw that the people were naked; (for Aaron had made
them naked unto their shame among their enemies
The KJV which renders the word "naked" here, renders the same word in Lev. 10:6 "uncover", accordingly. On the other hand, the KJV which renders the word "wild" and "letting lose", renders Lev. 10:6 "wild" or "unkempt", accordingly.