If your tax residency resides outside of the USA, and you made a taxable capital gain, I strongly advise to report it to your tax authority.
You should always do that! And if you are intelligent enough you can create easily structures so that everything is legal (like the big guys [e.g. Apple, Google] are doing). It only depends on the place where you are living how easy this world wide company structures can be set up.
those structures costs tens of thousands of dollars to setup as well as maintain. your taxable revenues must exceed the difference in effective tax rates versus the structure(s) maintenance costs in order for it to make sense.
"easily" is not the word I'd use for that. by my calculations your annual taxable (aka net) income would need to exceed 300,000 (USD/EUR) before you see a break even point.
plus there is the risk (did your accountants and lawyers set it up correctly? will the laws or regulations change next year? etc etc)
While I agree that there are morally legitimate ways of mitigating tax, I also think there are morally illegitimate ways. IMHO Apple and Google are going about their tax affairs in a morally illegitimate way.