You'd need to fabricate custom mounts, potentially modify the firewall or other body components, re-wire the entire system, and likely source a Dakota-compatible PCM. It's a significant undertaking requiring mechanical expertise and fabrication skills. It's far more complex than just swapping engines. The transmission compatibility also needs to be considered.
In short: It's *possible* with extensive modification, but it's not a straightforward swap. It would be much more practical and less costly to find a 318 that's already compatible with the 1999 Dakota or use a different engine that requires less modification.