How is interstellar gas density mapped from GAIA data?
Two techniques immediately spring to mind.

For the stars you detect, you can compare their colours and luminosities (Gaia provides photometric colours and distances) with what you expect for a star of that type at that distance. The difference between what you expect and what you observe tells you the reddening and extinction caused by interstellar dust, integrated in a column towards that star. By going through this process for lots of stars in different directions you build up a 3D picture of the distribution of dust.

The measurements are mostly insensitive to gas - simple extrapolation between dust and gas is often assumed.

A second technique would be just to compare how many stars you can see and with what brightness distribution, with a model for the Galactic stellar population and dust distribution. This is an old-fashioned way of estimating dust extinction, works well locally, but I suspect not what is used in that map, for the simple reasons that Gaia also provides the distances to stars, and one of the purposes of the mission is to improve the Galactic model, not assume it.