This can be done by setting the associations in your domain model correctly see here Another option is to use microflows as the data source for your references.
In Mendix, the scenario you describe would be handled with associations. There is no need for a separate attribute on the Department entity to keep store the value of the Car association. Assuming each car can only belong to 1 department, you could do this as follows:
When the user selects a department for a car, he will be setting the association between these two entities. The relationship is between the two objects, not an individual attributes of the two objects. After this association is chosen and saved, you can access it, in a microflow for instance, by using a retrieve action against that association. If you want to display a list of cars for a given department, create a dataview of the department entity, and inside of that dataview, put a datagrid whose datasource is the cars entity over the association between cars and department. Then you can display whatever attributes of the car entity you choose in the datagrid (model, year, odometer reading, color, etc.)
Hope this helps,