You also can't operate an outdoor shooting range unless you bank up the earth so that bullets that miss their targets don't hit people who live in houses located behind the range. If you run an indoor range, it must be constructed so that bullets don't fly through the walls into neighboring houses. These laws are all constitutional and generally accepted.
Why, then, not require people who have guns in their houses to make sure their bullets don't hit their neighbors?
It would be reasonable to require gun owners to bank up the earth or erect walls around their properties to contain errant bullets. That way, people would be able to keep guns at home to protect themselves but would not create an unreasonable danger to the families in their neighborhood.
There would be some expense involved in erecting safety barriers, but lots of laws impose financial burdens on people who want to use their properties in ways that present hazards. In many places, if you have a swimming pool, you have to erect a fence around it to keep neighborhood kids from drowning. If a pool owner has to pay to minimize the risk that a kid will drown, surely a gun owner should have to pay to minimize the risk that a kid will be shot.
It only makes sense that the people who create a risk of injury or death to the public by keeping guns should bear the cost of minimizing the risk. That's what the law says about driving automobiles. We don't expect motorists to intentionally crash their cars and injure their passengers, other motorists, and pedestrians, but we know that accidents can happen. We let people drive cars even though there is an inherent risk, but the law mandates safety features on cars to minimize the likelihood that accidents will happen and to minimize the consequences of those accidents. The cost of those safety features is included in the cost of the cars. The cost of preventing the accidental shooting of one's neighbor should similarly be paid by the people who want to have guns.
Some people might not want their properties to be walled in. They could be given the option of installing bullet-proof windows that could not be opened, provided that they understood that they could not take their guns out of their houses into their yards. Of course, their houses would have to be built of brick, stone, or some other material that would be impenetrable by bullets, because some of today's ammunition is capable of shooting right through aluminum siding and drywall. There have already been plenty of incidents where people were shot by bullets that came through their walls from outside their houses.
Requiring people to erect safety barriers on their property might seem like a drastic measure, but similar requirements have been imposed by law on commercial properties for years. Companies that handle flammable materials, for example, are required to construct their buildings to minimize the risk that an accidental explosion will endanger their neighbors. Nuclear power plants have to enclose their reactors in massive containment buildings for the same reason.
We live in a world of rights and corresponding responsibilities. The gun lobby has been telling us that people should have the right to keep guns in their homes so that they can take personal responsibility for the safety of their families. If they really believe in personal responsibility, they shouldn't have any objection to erecting barriers on their properties to assure that their activities don't endanger their neighbors. That would be real responsible gun ownership.