It's important to note that gold isn't strictly engineering/security it's "operations." In other words the people do the daily "grunt work" of operating and maintaining the ship. Data as the Operations Officer was largely in charge of those departments and its why he wore gold. He operated and coordinated those departments from his console on the bridge. Now at the same time he also served in some capacity as the "science officer" meaning he ran and interpreted the sensor data. But this is different than being a
science officer -someone who gathers and interprets data to prove a theory and studies the discoveries made by the ship. These people wore blue (the Sciences/Medical color.)
Data wasn't strictly a scientist on the ship he just happened to operate the sensors and such on the bridge, possibly gathering the data for the actual scientists to use and form conclusions with.