Truly artificial gravity? Well theoretically if you could bend space in a small place. So far I think only really likely way of doing that is with a tame black hole, if you could construct one, or find a mini black hole - then you'd have strong gravitational fields near to it, but maybe too strong, too much tidal forces..
But in Star Trek - then they clearly have the technology to warp space as desired, in an awesome way fold up lightyears worth of space into kilometers. If you can really do that - then probably you can just curve the space around your spacecraft to generate artificial g.
But we are long ways from doing that. Ideas for warping space do exist, even a "space warp" method of travel - but nowhere near practical - depends on exotic materials with negative energy which we don't have yet.
What we can do is create artificial gravity with spinning tethers or centrifuges, but that's not what you are asking I don't think.