It's very possible that Data serves extra shifts in Engineering when he's not on duty as Second Officer/Operations. In this second job, he's under the command of the Chief Engineer. In his first job, the opposite is true.
It's not that dissimilar to Spock doing double duty as both XO and Science Officer, and would occur for the same reasons: a more-than-human character who takes on a second job because he can handle it and because they can really use him.
Normally this would lead to some conflict, but the characters can get around that because they're friends. If it was Data and Logan, for example, it probably wouldn't work.