I feel like by and with are both correct but they mean different things and should be used in different context. for example i would use by if data were collected by someone (a person or a company) meanwhile I would use with if I want to mention instrument I used to collect data.
I'm am struggling with this specific sentence: "data were collected with a laser scanner"
It is correct? are my assumptions right?