Lasers are need to counter swarms of drone aircraft and boats. Guns simply cannot fire fast enough, or at multiple target simultaneously.
Sure they can.